# 基于 Ubuntu 22.04
FROM ubuntu:22.04

# 替换容器内 Ubuntu 源为清华源
RUN sed -i 's/archive.ubuntu.com/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list \
    && sed -i 's/security.ubuntu.com/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list

# 设置时区
ENV TZ='Asia/Shanghai'

# 安装必要工具
RUN apt-get update && \
    DEBIAN_FRONTEND=noninteractive apt-get install --yes \
      tzdata \
      ca-certificates \
      logrotate \
      cron \
    && DEBIAN_FRONTEND=noninteractive apt-get dist-upgrade --assume-yes --auto-remove \
    && DEBIAN_FRONTEND=noninteractive apt-get clean --assume-yes \
    && rm -rf /var/lib/apt/lists/* \
    && ln -fs /usr/share/zoneinfo/$TZ /etc/localtime

# 设置入口命令（启动 cron 并保持前台运行）
CMD ["cron", "-f"]